package com.harvey.study.data.structure.datastructure.game;

import com.harvey.study.data.structure.datastructure.linkedlist.Node;
import com.harvey.study.data.structure.datastructure.linkedlist.SingledLinkedListV2;

import lombok.Data;

@Data
public class User {
    private int totalScore;
    private int totalCards;
    private SingledLinkedListV2<Integer> poker = new SingledLinkedListV2<Integer>(); 


    public void receiveCard(int card){
        poker.add(card);
        totalScore += card;
        totalCards ++;
    }

    public boolean checkScore(){
        return totalScore<=21;
    }


    public void showCard(){
        Node<Integer> head = poker.getHead();
        while(head.getNext()!=null){
            head = head.getNext();
            System.out.print(head.getData()+" ");
        }
    }

    public void noShowFirstCard(){
        Node<Integer> head = poker.getHead();
        while(head.getNext()!=null){
            boolean first = false;
            if(head.getData() == null){
                first = true;
            }
            head = head.getNext();
            if(first){
                System.out.print("*"+" ");
            }else{
                System.out.print(head.getData()+" ");
            }
        }
    }

}
